<?php
include __DIR__ . "/binds/Json.php";

App::$argv = $argv;
App::run();


class App
{
    static $argv = [];
    static $options = [];

    public static function run()
    {
        self::parseArg();
        $method = 'index';
        $tag = self::$argv[1];
        $arr = explode(":", $tag);
        $className = new $arr[0];
        $rs = $className->$method(...array_slice(self::$argv, 2));
        print_r($rs);
    }

    public static function parseArg()
    {
        foreach (self::$argv as $arg) {
            $kv = explode("=", $arg);
            if ($kv[0] != "" && substr($kv[0], 0, 2) == '--') {
                $key = substr($kv[0], 2);
                if (!empty($key)) {
                    self::$options[$key] = isset($kv[1]) ? $kv[1] : '';
                }
            }
        }
    }
}
